<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="common/common.html::common_css">
</head>
<script>
    window.onload = function settime(obj) {
        var a = document.getElementById("btn");
        a.href = obj.href;
        //希望每次打开都要默认为今天日期+00:00
        //默认时间
        var myDate = new Date(), Y = myDate.getFullYear(), M = myDate.getMonth() + 1, D = myDate.getDate() + 1,
            D2 = myDate.getDate() + 2;
        //处理月是一位的情况
        if ((M + '').length == 1) {
            M = '0' + (M + '');
        }
        //处理日是一位的情况
        if ((D + '').length == 1) {
            D = '0' + (D + '')
        }
        if ((D2  + '').length == 1) {
            D2  = '0' + (D2  + '')
        }
        var curDay = Y + '-' + M + '-' + D;
        var curDay2 = Y + '-' + M + '-' + D2;
        document.getElementById("starttime").value = curDay + 'T00:00'
        document.getElementById("endtime").value = curDay2 + 'T00:00'
    }
</script>
<style>
    p {
        margin-left: 5px;
    }
</style>
<body>
<div th:replace="common/admin_common.html::common_sidebar"></div>
<div class="page">
    <div th:replace="common/admin_common.html::common_navbar"></div>
    <!-- Breadcrumb-->
    <div class="breadcrumb-holder">
        <div class="container-fluid">
            <ul class="breadcrumb">
                <li class="breadcrumb-item"><a th:href="@{/admin/admin_index.html}">主页</a></li>
                <li class="breadcrumb-item"><a th:href="@{/admin/testpaper_examine.html}">试卷审核</a></li>
                <li class="breadcrumb-item active">审核试卷</li>
            </ul>
        </div>
    </div>
    <section>
        <div class="container-fluid">
            <!-- Page Header-->
            <header>
                <h1 class="h3 display">试卷详情</h1>
            </header>
            <div class="row">
                <div class="col-lg-6" style="flex:100%;max-width: 100%">
                    <form id="paperinformation" class="text-left form-validate"
                          th:action="@{/admin/testpaper_examreacess.html}" method="post">
                        <input type="hidden" name="testpaperid" th:value="${testpaper.testpaperid}">
                        <div class="form-group-material">
                            <input id="testpapername" th:value="${testpaper.testpapername}" type="text"
                                   style="background-color: #fff !important;" name="testpapername" required
                                   data-msg="请输入试卷名称" class="input-material">
                            <label for="testpapername" class="label-material">试卷名称</label>
                        </div>
                        <div class="form-group-material">
                            <input type="hidden" name="apartmentid" th:value="${testpaper.apartmentid}">
                            <label class="label-material"
                                   style="color: #aaaaaa;">部门</label>
                            <p th:text="${testpaper.apartmentname}"></p>
                        </div>
                        <div class="form-group-material">
                            <input type="hidden" name="type" th:value="${testpaper.type}">
                            <label class="label-material"
                                   style="color: #aaaaaa;">试卷类型</label>
                            <p th:if="${testpaper.type}">固定组卷</p>
                            <p th:if="${not testpaper.type}">随机组卷</p>
                        </div>
                        <div class="form-group-material">
                            <input type="hidden" name="type" th:value="${testpaper.singlenum}">
                            <label class="label-material"
                                   style="color: #aaaaaa;">单选题数目</label>
                            <p th:text="${testpaper.singlenum}"></p>
                        </div>
                        <div class="form-group-material">
                            <input type="hidden" name="type" th:value="${testpaper.multiplenum}">
                            <label class="label-material"
                                   style="color: #aaaaaa;">多选题数目</label>
                            <p th:text="${testpaper.multiplenum}"></p>
                        </div>
                        <div class="form-group-material">
                            <input type="hidden" name="type" th:value="${testpaper.judgenum}">
                            <label class="label-material"
                                   style="color: #aaaaaa;">判断题数目</label>
                            <p th:text="${testpaper.judgenum}"></p>
                        </div>
                        <div class="form-group-material">
                            <input type="hidden" name="type" th:value="${testpaper.totalpoint}">
                            <label class="label-material"
                                   style="color: #aaaaaa;">试卷总分</label>
                            <p th:text="${testpaper.totalpoint}"></p>
                        </div>
                        <th:block th:if="${testpaper.status==2}">
                            <div class="form-group-material">
                                <input type="hidden" name="status" th:value="${testpaper.status}">
                                <label class="label-material"
                                       style="color: #aaaaaa;">状态</label>
                                <p style="color: deepskyblue">审核通过，即将开考</p>
                            </div>
                            <div class="form-group-material">
                                <input type="hidden" name="starttime" th:value="${testpaper.starttime}">
                                <label class="label-material"
                                       style="color: #aaaaaa;">开始时间</label>
                                <p style="color: deepskyblue" th:text="${testpaper.starttime}"></p>
                            </div>
                            <div class="form-group-material">
                                <input type="hidden" name="endtime" th:value="${testpaper.endtime}">
                                <label class="label-material"
                                       style="color: #aaaaaa;">截止时间</label>
                                <p style="color: deepskyblue" th:text="${testpaper.endtime}"></p>
                            </div>
                        </th:block>
                        <th:block th:if="${testpaper.status==1}">
                            <div class="form-group-material">
                                <input type="hidden" name="status" th:value="${testpaper.status}">
                                <label class="label-material"
                                       style="color: #aaaaaa;">状态</label>
                                <p style="color: orange">待审核</p>
                            </div>
                        </th:block>
                        <th:block th:if="${testpaper.status==3}">
                            <div class="form-group-material">
                                <input type="hidden" name="status" th:value="${testpaper.status}">
                                <label class="label-material"
                                       style="color: #aaaaaa;">状态</label>
                                <p style="color: red">审核未通过</p>
                            </div>
                        </th:block>
                        <th:block th:if="${testpaper.type}">
                            <div class="form-group-material">
                                <input type="hidden" name="type" th:value="${testpaper.totalpoint}">
                                <h4 class="label-material"
                                    style="color: #aaaaaa;">试卷内容</h4>
                                <table class="table">
                                    <tbody>
                                    <th:block th:if="${Squestions != null}">
                                        <tr>
                                            <td>
                                                <h5 class="label-material">单 选 题</h5>
                                            </td>
                                        </tr>
                                        <tr th:each="question:${Squestions}">
                                            <td>
                                                <div class="form-group-material">
                                                    <label class="label-material" th:text="${question.content}"></label>
                                                    <p th:if="${(question.optionA!= null and (not question.optionA.equals('')))}">
                                                        A <span th:text="${question.optionA}"></span></p>
                                                    <p th:if="${(question.optionB!= null and (not question.optionB.equals('')))}">
                                                        B <span th:text="${question.optionB}"></span></p>
                                                    <p th:if="${(question.optionC!= null and (not question.optionC.equals('')))}">
                                                        C <span th:text="${question.optionC}"></span></p>
                                                    <p th:if="${(question.optionD!= null and (not question.optionD.equals('')))}">
                                                        D <span th:text="${question.optionD}"></span></p>
                                                    <p th:if="${(question.optionE!= null and (not question.optionE.equals('')))}">
                                                        E <span th:text="${question.optionE}"></span></p>
                                                    <p th:if="${(question.optionF!= null and (not question.optionF.equals('')))}">
                                                        F <span th:text="${question.optionF}"></span></p>
                                                </div>
                                                <div class="form-group-material">
                                                    <p th:text="'答案: '+${question.answer}"></p>
                                                </div>
                                            </td>
                                        </tr>
                                    </th:block>
                                    <th:block th:if="${Mquestions != null}">
                                        <tr>
                                            <td>
                                                <h5 class="label-material">多 选 题</h5>
                                            </td>
                                        </tr>
                                        <tr th:each="question:${Mquestions}">
                                            <td>
                                                <div class="form-group-material">
                                                    <label class="label-material" th:text="${question.content}"></label>
                                                    <p th:if="${(question.optionA!= null and (not question.optionA.equals('')))}">
                                                        A <span th:text="${question.optionA}"></span></p>
                                                    <p th:if="${(question.optionB!= null and (not question.optionB.equals('')))}">
                                                        B <span th:text="${question.optionB}"></span></p>
                                                    <p th:if="${(question.optionC!= null and (not question.optionC.equals('')))}">
                                                        C <span th:text="${question.optionC}"></span></p>
                                                    <p th:if="${(question.optionD!= null and (not question.optionD.equals('')))}">
                                                        D <span th:text="${question.optionD}"></span></p>
                                                    <p th:if="${(question.optionE!= null and (not question.optionE.equals('')))}">
                                                        E <span th:text="${question.optionE}"></span></p>
                                                    <p th:if="${(question.optionF!= null and (not question.optionF.equals('')))}">
                                                        F <span th:text="${question.optionF}"></span></p>
                                                </div>
                                                <div class="form-group-material">
                                                    <p th:text="'答案: '+${question.answer}"></p>
                                                </div>
                                            </td>
                                        </tr>
                                    </th:block>
                                    <th:block th:if="${Jquestions != null}">
                                        <tr>
                                            <td>
                                                <h5 class="label-material">判 断 题</h5>
                                            </td>
                                        </tr>
                                        <tr th:each="question:${Jquestions}">
                                            <td>
                                                <div class="form-group-material">
                                                    <label class="label-material" th:text="${question.content}"></label>
                                                    <p th:if="${question.judgeanswer}">答案: 正 确</p>
                                                    <p th:if="${not question.judgeanswer}">答案: 错 误</p>
                                                </div>
                                            </td>
                                        </tr>
                                    </th:block>
                                    </tbody>
                                </table>
                            </div>
                        </th:block>
                        <div class="form-group text-center">
                            <a type="button" data-toggle="modal"
                               data-target="#myModal" class="btn btn-success m-b-10 m-1-5"
                               style="border-radius: 4px;margin-left: 5px">审核通过</a>
                            <a th:href="@{/admin/testpaper_examrefuse.html/{id}(id=${testpaper.testpaperid})}"
                               class="btn btn-danger m-b-10 m-1-5"
                               type="button" style="border-radius: 4px;margin-left: 50px">拒绝通过</a>
                            <a th:href="@{/admin/testpaper_examine.html}"
                               type="button" class="btn btn-warning m-b-10 m-1-5"
                               style="border-radius: 4px;margin-left: 50px">返回</a>
                        </div>
                        <!-- Modal-->
                        <div id="myModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
                             aria-hidden="true" class="modal fade text-left">
                            <div role="document" class="modal-dialog">
                                <div class="modal-content">
                                    <div class="modal-header" style="margin-left: 20px;margin-right: 20px">
                                        <h5 id="exampleModalLabel" class="modal-title">请安排考试时间</h5>
                                        <button type="button" data-dismiss="modal" aria-label="Close"
                                                class="close"><span aria-hidden="true">×</span></button>
                                    </div>
                                    <div class="form-group-material" style="margin-left: 20px;margin-right: 20px">
                                        <label for="starttime" class="label-material"
                                               style="margin-top: 30px;margin-bottom: 0">考试开始时间</label>
                                        <input id="starttime" type="datetime-local"
                                               style="background-color: #fff !important;" name="Tstarttime" required
                                               data-msg="请选择时间" class="input-material">
                                    </div>
                                    <div class="form-group-material" style="margin-left: 20px;margin-right: 20px">
                                        <label for="endtime" class="label-material"
                                               style="margin-bottom: 0px">考试截止时间</label>
                                        <input id="endtime" type="datetime-local"
                                               style="background-color: #fff !important;" name="Tendtime" required
                                               data-msg="请选择时间" class="input-material">
                                    </div>
                                    <div class="form-group-material" style="margin-left: 20px;margin-right: 20px">
                                        <label for="timelimt" class="label-material"
                                               style="margin-bottom: 0px">考试时长</label>
                                        <input id="timelimt" type="number" style="background-color: #fff !important;"
                                               name="timelimt" required data-msg="请输入考试时长（分钟）" class="input-material">
                                    </div>
                                    <div class="modal-footer"
                                         style="display: block;padding: 1rem;text-align: center;margin-left: 20px;margin-right: 20px">
                                        <button type="button" data-dismiss="modal" class="btn btn-secondary">
                                            取消
                                        </button>
                                        <button id="btn" type="submit" class="btn btn-primary"
                                                style="margin-left: 100px">确定
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </section>
    <div th:replace="common/common.html::common_footer"></div>
</div>
<div th:replace="common/common.html::common_js">
</div>
</body>
</html>